package com.joysuch.wwyt.bp.controller;


import com.joysuch.wwyt.bp.entity.vo.InvFlowFieldMappingVo;
import com.joysuch.wwyt.bp.service.BpInvFlowFieldMappingService;
import com.joysuch.wwyt.core.common.ajax.ResultBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author heqifeng
 * @since 2022-04-14
 */
@RestController
@RequestMapping("/bp/bp-inv-flow-field-mapping")
@Api(tags = "隐患排查-隐患治理流程字段映射")
public class BpInvFlowFieldMappingController {

    @Autowired
    private BpInvFlowFieldMappingService service;

    @PostMapping("/saveOrUpdate")
    @ApiOperation("新增/修改")
    public ResultBean saveOrUpDate(@RequestBody InvFlowFieldMappingVo mappingVo) {
        return ResultBean.success(service.addOrUpdate(mappingVo));
    }

    @GetMapping("/list/{sourceType}")
    @ApiOperation("列表页")
    public ResultBean list(@PathVariable Integer sourceType) {
        return ResultBean.success(service.listByType(sourceType));
    }

}